//
//  UINavigationController+Extend.swift
//  Tala
//
//  Created by 千策万划-mini on 2025/5/2.
//

import Foundation

extension UINavigationController {
    
    // MARK: - 根据类名字符串 pop 到指定页面
    func popToClass(_ className: String, animated: Bool = true) {
        for vc in viewControllers {
            if NSStringFromClass(type(of: vc)) == className || String(describing: type(of: vc)) == className {
                popToViewController(vc, animated: animated)
                return
            }
        }
        popViewController(animated: animated)
    }
}
